<?php !defined('DYHB_PATH') && exit; /* DoYouHaoBaby Framework 模板缓存文件 生成时间：2011-05-28 11:36:58  */ ?>
<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_header.html" ,"" ,"" ,"" )  ;?>

   <!-- 标题  -->
   <div class="title"><?php print G::L( "数据库备份文件列表", null, null ) ; ?> ( <a href="<?php echo( G::U('backup/index') );?>"><?php print G::L( "数据库备份", null, null ) ; ?></a> | <a href="<?php echo( G::U('backup/runsql') );?>"><?php print G::L( "运行SQL语句", null, null ) ; ?></a> | <a href="<?php echo( G::U('backup/optimize') );?>"><?php print G::L( "数据库优化", null, null ) ; ?></a> )</div>

   <?php if(!empty( $sWarning )) :?><div id="content_warning"><?php echo( $sWarning ); ?></div><?php endif; ?>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<?php echo( G::U('backup/upload_sql') );?>" method="post" id="upload_sql" enctype="multipart/form-data" name="upload_sql" >
      <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><?php print G::L( "本地上传恢复备份", null, null ) ; ?></label></td>
              <td><input type="file" name="sqlfile" size="50" class="field" >
              <div class="description"><?php print G::L( "你可以直接导入本地sql文件进行数据恢复", null, null ) ; ?></div></td>
            </tr>

       </table>
       <p class="center">
          <input type="button"  class="button" value=" <?php print G::L( "上传并执行sql语句", null, null ) ; ?>  " onclick="importFileConfrim()" />
          <input type="reset" class="button" value="  <?php print G::L( "重  置", null, null ) ; ?>  " />
        </p>
        </form>
        <br/>
      <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><?php print G::L( "服务器备份文件管理", null, null ) ; ?> </label></td>
              <td><div class="description"><?php print G::L( "你可以使用服务器中的备份文件进行数据恢复", null, null ) ; ?></div></td>
            </tr>

      </table>
      <form action="<?php echo( G::U('backup/remove') );?>" method="post" id="sqlList" name="sqlList" >
      <table class="data full" id="checkList">
        <thead>
        <tr>
           <th width="5px"><input onclick="CheckAll('checkList')" type="checkbox"></th>
           <th><?php print G::L( "文件名", null, null ) ; ?></th>
           <th><?php print G::L( "时间", null, null ) ; ?></th>
           <th><?php print G::L( "大小", null, null ) ; ?></th>
           <th><?php print G::L( "卷", null, null ) ; ?></th>
           <th><?php print G::L( "操作", null, null ) ; ?></th>
        </tr>
        </thead>
        <tbody>
        <?php $i=1 ;?>
<?php if( is_array( $arrList ) ) : foreach( $arrList as $key=>$value): ?>

        <tr <?php if( $value['mark'] == 2 ) :?>style="display:none;"<?php endif; ?>>
           <td><input type="checkbox" name="file[]" value="<?php echo( $value['name'] ); ?>" /></td>
           <td><?php if( $value['mark'] == 1 ) :?><img onClick="rowClick(this)" src="__TMPLPUB__/Images/menu_plus.gif" >
           <?php elseif( $value['mark'] == 2 ) :?><img src="__TMPLPUB__/Images/menu_arrow.gif"><?php endif; ?><a href="__APPPUB__/Backup/<?php echo( $value['name'] ); ?>"><?php echo( $value['name'] ); ?></a></td>
           <td><?php echo( $value['add_time'] ); ?></td>
           <td><?php echo( $value['file_size'] ); ?></td>
           <td>vol:<?php echo( $value['vol'] ); ?></td>
           <td align="center"><?php if( $value['mark'] == 1 || $value['mark']=='0' ) :?><a href="<?php echo( G::U('backup/import?file_name='.$value['name']) );?>">[导入]</a><?php else: ?>&nbsp;<?php endif; ?></td>
           </tr>
         
<?php $i++ ;?>
<?php endforeach;endif; ?>
        </tbody>
        </table>
        <table class="form-table full">
          <tr>
              <th valign="top"><label for="node_title"  class="field"><?php print G::L( "备份操作", null, null ) ; ?> </label></td>
              <td><input type="button" value="  <?php print G::L( "删除备份文件", null, null ) ; ?>   " class="button" onclick="deleteFileConfrim()"/>
              <div class="description"><?php print G::L( "你可以对备份文件进行操作，备份文件一旦被删除，不能够被恢复", null, null ) ; ?></div></td>
            </tr>

      </table>
      </form>

<script type="text/javascript">
function importFileConfrim(){

	dyhbConfirm( D.L( '你确定要导入选中数据吗？' ),function( dialogInstance ){

       dialogInstance.DispatchEvent("onaccept") && dialogInstance.close();
       Dyhb.Dom.$( 'upload_sql').submit();
	} );
}

function deleteFileConfrim(){

    dyhbConfirm( D.L( '你确定要删除选中数据吗？' ),function( dialogInstance ){

       dialogInstance.DispatchEvent("onaccept") && dialogInstance.close();
	   Dyhb.Dom.$( 'sqlList').submit();
	} );
}

function rowClick(obj){

  var row = obj.parentNode.parentNode;
  var tbl = row.parentNode.parentNode;
  var test = false;
  var img = '';

  if (obj.src.substr(obj.src.lastIndexOf('/') + 1) == "menu_minus.gif")
  obj.src = "__TMPLPUB__/Images/menu_plus.gif";
  else
  obj.src = "__TMPLPUB__/Images/menu_minus.gif";

  for (i = 0; i < tbl.rows.length; i++){

    var cell = tbl.rows[i].cells[1];

    if (cell && cell.childNodes[0].src){

      img = cell.childNodes[0].src.substr(cell.childNodes[0].src.lastIndexOf('/') + 1);
    }

    else{

      img = '';
    }

    if (test && img){

      if (img == "menu_arrow.gif"){

        tbl.rows[i].style.display = tbl.rows[i].style.display != 'none' ? 'none' :(Dyhb.Browser.Ie) ? 'block' : 'table-row';
      }

      else{

        test=false;
      }
    }

    if (tbl.rows[i] == row){

      test = true;
    }
  }

}

//-->
</script>
   </div>
   <!-- end content -->

<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_footer.html" ,"" ,"" ,"" )  ;?>